package lunsfordhall.androidapp;

import android.R;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.AdapterView.OnItemClickListener;
// ΔμΩωθɛ
public class listofmechanicalformulas extends ListActivity{

	private String[] formulas = {"Δd=1/2(vi+vf)Δt","F=ma","PE=1/2kx^2","W=FdCosθ","KE=1/2mv^2","PE=mgh","P=W/Δt"};//strings the list click menu

	@Override
	public void onCreate(Bundle savedInstanceState) {//bundles work
        super.onCreate(savedInstanceState);
        setListAdapter(new ArrayAdapter<String>(this, R.layout.simple_list_item_1, formulas));// formats the veiw as a list
        
     
getListView().setOnItemClickListener(new OnItemClickListener() {//listens to the position of the text	 
            
			public void onItemClick(AdapterView<?> parent, View view, int position,// diverts to the next fule
					long id) {
				Intent showIntent = null;
				
				 if(position == 0){
					  showIntent = new Intent(getApplicationContext(),Physics_form_1.class);//receives from earlier list 
				 }else if(position ==1){
					 showIntent = new Intent(getApplicationContext(),Form2.class);//receives from earlier list 
				 }else if(position ==2){
					 showIntent = new Intent(getApplicationContext(),Form3.class);//receives from earlier list 
				 }
				 
				 
				 startActivity(showIntent);
			}		
        });
        
    }
	
	
	
	
	public boolean onKeyDown(int keyCode, KeyEvent event) {
	    super.onKeyDown(keyCode, event);
	    if(keyCode == KeyEvent.KEYCODE_BACK){
	    	finish();
	    	return true;
	    }
	    else return false;
}
	
	
}